<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
<%@include file="../meta.jsp" %>   
<script type="text/javascript">	
	$(
		function(){
			$('#query').click(
				function(){
					$("#queryForm").attr("action","${pageContext.request.contextPath}/agent/index");
					$("#queryForm").submit();
				}
			);
			$('#export_excel').click(
					function(){
						$("#queryForm").attr("action","${pageContext.request.contextPath}/agent/exportExcel");
						$("#queryForm").submit();
					}
				);
		}
	);
</script>
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>消费记录</h3>
        <ul class="content-box-tabs">
          <li><a href="#tab1" class="default-tab">列表</a></li>
<!--           <li><a href="#tab2">查询</a></li> -->
        </ul>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
        <c:if test="${ tip != null }">    
          <div class="notification attention png_bg"> <a href="#" class="close"><img src="${pageContext.request.contextPath}/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
            <div> ${ tip } </div>
          </div>
          </c:if>
          <table>
            <thead>
              <tr>
               <td colspan="5">
               	  <div class="bulk-actions align-left">
			          <form id="queryForm" action="${pageContext.request.contextPath}/agent/index" method="post">
			          	  <font style="color: #555555;font-weight: bold;">开始时间</font>
			          	  <input class="text-input button_min" onclick="WdatePicker({lang:'zh',skin:'whyGreen',dateFmt:'yyyy-MM-dd'});" readonly="readonly" type="text" id="startTime" name="startTime" value="${param.startTime }"/>
			          	  <font style="color: #555555;font-weight: bold;">结束时间</font>
			          	  <input class="text-input button_min" onclick="WdatePicker({lang:'zh',skin:'whyGreen',dateFmt:'yyyy-MM-dd'});" readonly="readonly" type="text" id="endTime" name="endTime" value="${param.endTime }"/>
			          	  <font style="color: #555555;font-weight: bold;">商户账号</font>
			          	  <input class="text-input button_min" type="text" id="providerAccount" name="providerAccount" value="${param.providerAccount }"/>
			              
			              <input id="query" class="button button_min" type="button" value="查询" />
			          </form>
			        </div>
			        <input id="export_excel" class="button button_min" type="button" value="导出报表" />
               </td>
              </tr>
              <tr style="background-color:silver;">
                <th width="20%">电子券序列号</th>
                <th width="20%">所属用户</th>
                <th width="20%">兑换日期</th>
                <th width="20%">商户名称</th>
                <th width="20%">商户账号</th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="5">
                 	<jsp:include  page="page.jsp" flush="true"/>
                  <!-- End .pagination -->
                  <div class="clear"></div>
                </td>
              </tr>
            </tfoot>
            <tbody id="recordItems">
             <c:if test="${empty page.datas}">
              <tr>
	          	<td colspan="5">
	          		<div >查找不到相关记录信息！</div>
	          		<input name="record" type="hidden" />
	          	</td>
              </tr>
	         </c:if>
             <c:if test="${!empty page.datas}">
	          <c:forEach items="${page.datas}" var="record" varStatus="i">
	          <tr class="item">
	          	<td>${record.consume.serialNumber }</td>
                <td>${record.consume.userId }</td>
                <td><fmt:formatDate value='${record.consume.consumptionTime }' pattern='yyyy-MM-dd HH:mm:ss'/></td>
                <td>${record.provider.providerName }</td>
                <td >${record.provider.operatorAccount }</td>
	          </tr>
	          </c:forEach>
          </c:if>
            
            </tbody>
          </table>
        </div>
          <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>
    <div class="clear"></div>
    <!-- End .clear -->
   